package handler

import (
	"context"
	"fmt"
	orderpb "gitee.com/worklz/grpc-mtls-demo/server-order/proto/order"
)

type OrderHandler struct {
	orderpb.UnimplementedOrderServiceServer // 关键：嵌入默认实现
}

var _ orderpb.OrderServiceServer = (*OrderHandler)(nil)

func NewOrderHandler() *OrderHandler {
	return &OrderHandler{}
}

func (h *OrderHandler) GetList(ctx context.Context, req *orderpb.GetListRequest) (*orderpb.OrderResponse, error) {
	return &orderpb.OrderResponse{
		Success: true,
		Message: fmt.Sprintf("获取订单列表成功！page=%d page_size=%d user_id=%d", req.Page, req.PageSize, req.UserId),
	}, nil
}
